<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/header.jsp"%>
<div id='container'>
    书籍分类：
    <c:forEach items="${cs.records}" var="c">
    	<a href="${pageContext.request.contextPath}/client/CilentServlet?op=listBooksByCategoryId&categoryId=${c.id}">${c.name}</a>&nbsp;&nbsp;
    </c:forEach>
    <br/><br/><br/>
    <div class="lit">
    <table>
    	<tr>
    		<c:forEach items="${page.records}" var="b">
    			<td style='width: 140px;display: inline-block;padding:5px 5px;'>
    				<img src="${pageContext.request.contextPath}/images/${b.path}/${b.filename}"  width="87"  height="117"/><br/>
    				<div class='books_1'>书名：${b.name}</div>
    				<div class='books_1'>作者：${b.author}</div>
    				<div class='books_1'>剩余：${b.total}本</div>
    				<div class='books_1'>单价：${b.price}￥</div>
    				<a href="javascript:sureBook('${b.total}','${b.id}')">加入借书清单</a>
    			</td>
    		</c:forEach>
    	</tr>
    </table>
    </div>
    <br/>
    <%@ include file="/commons/page.jsp"%>
    </div>
     <script type="text/javascript">
   		function sureBook(total,bookId){
   			if(total>0){
   				window.location.href="	${pageContext.request.contextPath}/client/CilentServlet?op=buy&bookId="+bookId;
   			}else{
   				alert("亲，这本书已经被借完了!请联系管理员添加书籍!");
   			}
   			
   		}
	</script>
  </body>
</html>
